package com.aaa.mrcai.service.impl;

import com.aaa.mrcai.mapper.MineMapper;
import com.aaa.mrcai.pojo.entity.UserInfo;
import com.aaa.mrcai.pojo.vo.MineVO;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.MineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author meowyf
 * @version 1.0
 * @Name Z_MJ
 * @date 2021/12/10 19:19:23
 */
@Service
public class MineServiceImpl implements MineService {
    @Autowired
    private MineMapper mineMapper;
    @Override
    public AjaxResult list(int uid) {
        UserInfo i = mineMapper.listAll(uid);
        return AjaxResult.success(i);
    }

    @Override
    public AjaxResult updateMine(MineVO mineVO) {

        if ("男".equals(mineVO.getUsex())||"女".equals(mineVO.getUsex())){
            int i = mineMapper.updateMine(mineVO);

            return AjaxResult.success();
        }
        return AjaxResult.defeated();
    }

    @Override
    public AjaxResult uploadBicon(MineVO mineVO) {
        int i = mineMapper.uploadBicon(mineVO);
        if (i>0){
            return AjaxResult.success();
        }
        return AjaxResult.defeated();
    }

}
